﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="SalesReport.aspx.cs" Inherits="FYPHP.Reports.SalesReport" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">    var num = 0; </script>
    <h2>
        Report for Transaction</h2>
<table>
<tr><td>Type</td><td>:</td>
<td><asp:RadioButtonList ID="RadioButtonList1" runat="server" 
        RepeatDirection="Horizontal" AutoPostBack="True" 
            onselectedindexchanged="RadioButtonList1_SelectedIndexChanged">
        <asp:ListItem Value="Daily" Selected="True">Daily</asp:ListItem>
        <asp:ListItem Value="Monthly">Monthly</asp:ListItem>
        <asp:ListItem Value="Yearly">Yearly</asp:ListItem>
</asp:RadioButtonList></td></tr>
<tr><td>Sort by</td><td>:</td>
<td><asp:DropDownList ID="DropDownList1" runat="server">
    </asp:DropDownList>
    <asp:CheckBox ID="CheckBox1" runat="server" Text="Descending" style="font-size: 12px;" /></td></tr>

    <asp:ScriptManager ID="ScriptManager1" runat="server" />

    <asp:Panel ID="Panel1" runat="server" Visible="False">
    <tr><td>From Date</td><td>:</td><td>
    <asp:TextBox ID="TextBox1" runat="server" AutoCompleteType="Disabled"></asp:TextBox>
    <ajaxToolkit:CalendarExtender ID="CalendarExtenderDM" runat="server"
            TargetControlID="TextBox1" Format="dd/MM/yyyy" /></td></tr>
    <tr><td>To Date</td><td>:</td><td>
    <asp:TextBox ID="TextBox3" runat="server" AutoCompleteType="Disabled"></asp:TextBox>
    <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server"
            TargetControlID="TextBox3" Format="dd/MM/yyyy" /></td></tr>
    </asp:Panel>


    <asp:Panel ID="Panel2" runat="server" Visible="False">
    <tr><td>Month</td><td>:</td><td>
        <asp:DropDownList ID="ddlMonth" runat="server">
        </asp:DropDownList>
    </td></tr>
    </asp:Panel>

    <tr><td colspan="2"></td><td>
    <asp:Button ID="btnSort" runat="server" Text="View Report" onclick="btnSort_Click" /></td></tr>
</table>    
    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="View1" runat="server">
            <asp:Repeater ID="ItemList" runat="server" onitemcommand="ItemList_ItemCommand">
                <HeaderTemplate>
                    <table cellpadding="5" cellspacing="5" width="722" border="1px solid #ffffff" align="center" style="border-collapse: collapse; border-color: #aaaaaa; text-align: center; margin-top: 5px">
                        <tr style="background-color: #eee; font-weight: bold;">
                            <td width="30px">
                                No.</td>
                            <td>
                                Date</td>
                            <td>
                                Reference No.</td>
                            <td>
                                Buyer</td>
                            <td>
                                Seller</td>
                            <td>
                                Total</td>
                            <td>
                                Action</td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <script type="text/javascript">
 num += 1; document.write(num);</script>
                        </td>
                        <td width="80">
                            <%#DataBinder.Eval(Container.DataItem, "tdate" ) %>
                        </td>
                        <td>
                            <%#formatRef(DataBinder.Eval(Container.DataItem, "t_id" )) %>
                        </td>
                          <td width="80">
                            <%#DataBinder.Eval(Container.DataItem, "uusername")%>
                        </td>
                        <td width="80">
                             <%#DataBinder.Eval(Container.DataItem, "username")%>
                        </td>
                        <td width="80">
                            $<%#DataBinder.Eval(Container.DataItem, "t_total" ) %>
                        </td>
                        <td width="100">
                            <asp:Button ID="btnView" runat="server" Text="View Details" CommandName="View" 
        CommandArgument='<%# Eval("t_id").ToString() %>' />
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                </FooterTemplate>
            </asp:Repeater>
            <tr style="font-weight: bold;">
                <td colspan="5" align="right">
                    Total</td>
                <td>
                    $<asp:Label ID="lblTotal" runat="server"></asp:Label>
                </td>
            </tr>
            </table>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <asp:Repeater ID="ItemList2" runat="server" onitemcommand="ItemList_ItemCommand">
                <HeaderTemplate>
                    <table cellpadding="5" cellspacing="5" width="722" border="1px solid #ffffff" align="center" style="border-collapse: collapse; border-color: #aaaaaa; text-align: center; margin-top: 5px">
                        <tr style="background-color: #eee; font-weight: bold;">
                            <td width="30px">
                                No.</td>
                            <td>
                                Year</td>
                            <td>
                                Month</td>
                            <td>
                                Total Transactions</td>
                            <td>
                                Total</td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <script type="text/javascript">
num += 1; document.write(num);</script>
                        </td>
                        <td width="60">
                            <%#DataBinder.Eval(Container.DataItem, "tyear" ) %>
                        </td>
                        <td width="90">
                            <%#DataBinder.Eval(Container.DataItem, "tmonth" ) %>
                        </td>
                        <td>
                            <%#DataBinder.Eval(Container.DataItem, "ttrans" ) %>
                        </td>
                        <td>
                            $<%#DataBinder.Eval(Container.DataItem, "ttotal" ) %>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                </FooterTemplate>
            </asp:Repeater>
            <tr style="font-weight: bold;">
                <td colspan="4" align="right">
                    Total</td>
                <td>
                    $<asp:Label ID="lblTotal2" runat="server"></asp:Label>
                </td>
            </tr>
            </table>
        </asp:View>
        <asp:View ID="View3" runat="server">
            <asp:Repeater ID="ItemList3" runat="server" onitemcommand="ItemList_ItemCommand">
                <HeaderTemplate>
                    <table cellpadding="5" cellspacing="5" width="722" border="1px solid #ffffff" align="center" style="border-collapse: collapse; border-color: #aaaaaa; text-align: center; margin-top: 5px">
                        <tr style="background-color: #eee; font-weight: bold;">
                            <td width="30px">
                                No.</td>
                            <td>
                                Year</td>
                            <td>
                                Total Transactions</td>
                            <td>
                                Total</td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <script type="text/javascript">
num += 1; document.write(num);</script>
                        </td>
                        <td width="60">
                            <%#DataBinder.Eval(Container.DataItem, "tyear" ) %>
                        </td>
                        <td>
                            <%#DataBinder.Eval(Container.DataItem, "ttrans" ) %>
                        </td>
                        <td>
                            $<%#DataBinder.Eval(Container.DataItem, "ttotal" ) %>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                </FooterTemplate>
            </asp:Repeater>
            <tr style="font-weight: bold;">
                <td colspan="3" align="right">
                    Total</td>
                <td>
                    $<asp:Label ID="lblTotal3" runat="server"></asp:Label>
                </td>
            </tr>
            </table>
        </asp:View>
    </asp:MultiView>
</asp:Content>
